"""
@Project:Python crawler
@File:python 闭包.py
@Author:邓建祥
@Date:9:52
"""

import time

def timeit(func):
    start = time.time()
    func()
    end = time.time()
    print(f"{func}执行时间{int(end-start)}秒")

def hello_one():
    print("Hello_one运行")
    time.sleep(1)

def hello_two():
    print("Hello_two运行")
    time.sleep(3)

timeit(hello_one)
timeit(hello_two)

def timeit(func):
    def inner():
        start = time.time()
        func()
        end = time.time()
        print(f"{func}执行时间{int(end-start)}")
    return inner

def hello_one():
    print("Hello_one运行")
    time.sleep(1)


hello_one = timeit(hello_one)
hello_one()

